<?php
namespace app\controller;

use think\facade\View;
use think\facade\Db;
class Student{
    public function index()
    {
        $select=Db::table('stu_info')
                ->alias('a')
                ->join('stu_grade b','a.sid=b.sid')
                ->join('stu_course c','c.cid=b.cid')
                ->field('a.sid as stuno,name,class,subject,score')
                ->select();
        View::assign("stu",$select);
        //print_r($select->toArray());
        return View::fetch();
    }    
    public function say()
    {
        //return '大家好，我是王五。';
        return View::fetch();
    }
    public function show(){
       
        $stu=[
            ['id'=>1001,'name'=>'张三','sex'=>'0','phone'=>'13887654321'],
            ['id'=>1002,'name'=>'李四','sex'=>'1','phone'=>'13387654321'],
            ['id'=>1003,'name'=>'王五','sex'=>'0','phone'=>'13187654321'],
            ['id'=>1004,'name'=>'马六','sex'=>'1','phone'=>''],
            ['id'=>1005,'name'=>'赵七','sex'=>'1','phone'=>'15887654321']
        ];
       
        View::assign('stu',$stu);

        return View::fetch();
    }
}